package UnOfficeDeTourisme;

/**
 * Interface definition : SGSites
 * 
 * @author OpenORB Compiler
 */
public abstract class SGSitesPOA extends org.omg.PortableServer.Servant
        implements SGSitesOperations, org.omg.CORBA.portable.InvokeHandler
{
    public SGSites _this()
    {
        return SGSitesHelper.narrow(_this_object());
    }

    public SGSites _this(org.omg.CORBA.ORB orb)
    {
        return SGSitesHelper.narrow(_this_object(orb));
    }

    private static String [] _ids_list =
    {
        "IDL:UnOfficeDeTourisme/SGSites:1.0"
    };

    public String[] _all_interfaces(org.omg.PortableServer.POA poa, byte [] objectId)
    {
        return _ids_list;
    }

    public final org.omg.CORBA.portable.OutputStream _invoke(final String opName,
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler)
    {

        if (opName.equals("_get_listeDesSotes")) {
                return _invoke__get_listeDesSotes(_is, handler);
        } else if (opName.equals("ajouterSite")) {
                return _invoke_ajouterSite(_is, handler);
        } else if (opName.equals("ajouterTypeEntree")) {
                return _invoke_ajouterTypeEntree(_is, handler);
        } else if (opName.equals("ajouterVisite")) {
                return _invoke_ajouterVisite(_is, handler);
        } else if (opName.equals("calculerStatistiques")) {
                return _invoke_calculerStatistiques(_is, handler);
        } else if (opName.equals("getPosProches")) {
                return _invoke_getPosProches(_is, handler);
        } else if (opName.equals("getVisites")) {
                return _invoke_getVisites(_is, handler);
        } else if (opName.equals("majSite")) {
                return _invoke_majSite(_is, handler);
        } else {
            throw new org.omg.CORBA.BAD_OPERATION(opName);
        }
    }

    // helper methods
    private org.omg.CORBA.portable.OutputStream _invoke__get_listeDesSotes(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        UnOfficeDeTourisme.genericEntry[] arg = listeDesSotes();
        _output = handler.createReply();
        UnOfficeDeTourisme.hashMapObectId_IORHelper.write(_output,arg);
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_ajouterVisite(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        UnOfficeDeTourisme.Site arg0_in = UnOfficeDeTourisme.SiteHelper.read(_is);
        UnOfficeDeTourisme.Visite arg1_in = UnOfficeDeTourisme.VisiteHelper.read(_is);

        ajouterVisite(arg0_in, arg1_in);

        _output = handler.createReply();

        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_ajouterSite(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        UnOfficeDeTourisme.Site arg0_in = UnOfficeDeTourisme.SiteHelper.read(_is);

        ajouterSite(arg0_in);

        _output = handler.createReply();

        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_ajouterTypeEntree(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        UnOfficeDeTourisme.Site arg0_in = UnOfficeDeTourisme.SiteHelper.read(_is);
        UnOfficeDeTourisme.Visite arg1_in = UnOfficeDeTourisme.VisiteHelper.read(_is);
        float arg2_in = _is.read_float();
        String arg3_in = _is.read_string();

        ajouterTypeEntree(arg0_in, arg1_in, arg2_in, arg3_in);

        _output = handler.createReply();

        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_getVisites(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        UnOfficeDeTourisme.Site[] arg0_in = UnOfficeDeTourisme.listeSitesHelper.read(_is);

        try
        {
            UnOfficeDeTourisme.Visite[] _arg_result = getVisites(arg0_in);

            _output = handler.createReply();
            UnOfficeDeTourisme.listeVisitesHelper.write(_output,_arg_result);

        }
        catch (UnOfficeDeTourisme.ListeVideException _exception)
        {
            _output = handler.createExceptionReply();
            UnOfficeDeTourisme.ListeVideExceptionHelper.write(_output,_exception);
        }
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_calculerStatistiques(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        UnOfficeDeTourisme.Site[] arg0_in = UnOfficeDeTourisme.listeSitesHelper.read(_is);

        UnOfficeDeTourisme.statistiques _arg_result = calculerStatistiques(arg0_in);

        _output = handler.createReply();
        UnOfficeDeTourisme.statistiquesHelper.write(_output,_arg_result);

        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_getPosProches(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        UnOfficeDeTourisme.GPS arg0_in = UnOfficeDeTourisme.GPSHelper.read(_is);

        try
        {
            UnOfficeDeTourisme.Visite[] _arg_result = getPosProches(arg0_in);

            _output = handler.createReply();
            UnOfficeDeTourisme.listeVisitesHelper.write(_output,_arg_result);

        }
        catch (UnOfficeDeTourisme.ListeVideException _exception)
        {
            _output = handler.createExceptionReply();
            UnOfficeDeTourisme.ListeVideExceptionHelper.write(_output,_exception);
        }
        return _output;
    }

    private org.omg.CORBA.portable.OutputStream _invoke_majSite(
            final org.omg.CORBA.portable.InputStream _is,
            final org.omg.CORBA.portable.ResponseHandler handler) {
        org.omg.CORBA.portable.OutputStream _output;
        UnOfficeDeTourisme.Site arg0_in = UnOfficeDeTourisme.SiteHelper.read(_is);
        UnOfficeDeTourisme.datecut arg1_in = UnOfficeDeTourisme.datecutHelper.read(_is);
        UnOfficeDeTourisme.datecut arg2_in = UnOfficeDeTourisme.datecutHelper.read(_is);

        majSite(arg0_in, arg1_in, arg2_in);

        _output = handler.createReply();

        return _output;
    }

}
